const checkPermission = (el, binding) => {
    const {value} = binding;
    const points = user

    if (Array.isArray(value)) {
        const hasPermission = points.some(point => value.includes(point));
        if (!hasPermission) {
            el.parentNode && el.parentNode.removeChild(el);
        }
    } else {
        throw new Error('v-permission value must be an array');
    }
}

const permissonDirective = {
    mounted(el, binding) {
        checkPermission(el, binding);
    },
    updated(el, binding) {
        checkPermission(el, binding);
    }
};

export default permissonDirective